/*
Copyright (C) 2009-2010 Xanadu Development Team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#pragma once

#include "MessengerMembers.h"
#include "../server/Player.h"
#include <vector>

class MessengerMembers;
class Player;
class World;

class Messenger{
private:
	int id;
	MessengerMembers* members;
public:
	~Messenger();
	Messenger(Player *player, int id);
	int getId() {
		return id;
	}
	MessengerMembers* getMembers() {
		return members;
	}
	int getMembersCount() {
		return members->getMembers()->size();
	}
};

class Messengers {
private:
	World* world;
	stdext::hash_map <int, Messenger*> messengers;
public:
	Messengers(World *world) {
		this->world = world;
	}
	Messenger *getMessenger(int id) {
		return messengers[id];
	}
	void remove(int id) {
		messengers.erase(id);
	}
	void create(Player *player);
	void join(Player *player, int messengerId);
};